from app import db


class Uploadhw(db.Model):
    __tablename__ = 'tbl_uploadhw'
    Stu_id = db.Column(db.String(10), primary_key=True)
    HW_id = db.Column(db.String(10), primary_key=True)
    HW_time = db.Column(db.DateTime, nullable=False)
    HW_address = db.Column(db.String(200), nullable=True)

    def to_json(self):
        return {
            "Stu_id": self.Stu_id,
            "HW_id": self.HW_id,
            "HW_time": str(self.HW_time),
            "HW_address": self.HW_address
        }
